home *** CD-ROM | disk | FTP | other *** search
/ AmigActive 24 / AACD 24.iso / AACD / Programming / gcc-2.95.3-3 / info / gcc.info-13 < prev    next >
Encoding:
GNU Info File  |  2001-07-15  |  49.2 KB  |  1,144 lines

  1. This is Info file gcc.info, produced by Makeinfo version 1.68 from the
  2. input file ./gcc.texi.
  3.  
  4. INFO-DIR-SECTION Programming
  5. START-INFO-DIR-ENTRY
  6. * gcc: (gcc).                  The GNU Compiler Collection.
  7. END-INFO-DIR-ENTRY
  8.    This file documents the use and the internals of the GNU compiler.
  9.  
  10.    Published by the Free Software Foundation 59 Temple Place - Suite 330
  11. Boston, MA 02111-1307 USA
  12.  
  13.    Copyright (C) 1988, 1989, 1992, 1993, 1994, 1995, 1996, 1997, 1998,
  14. 1999, 2000 Free Software Foundation, Inc.
  15.  
  16.    Permission is granted to make and distribute verbatim copies of this
  17. manual provided the copyright notice and this permission notice are
  18. preserved on all copies.
  19.  
  20.    Permission is granted to copy and distribute modified versions of
  21. this manual under the conditions for verbatim copying, provided also
  22. that the sections entitled "GNU General Public License" and "Funding
  23. for Free Software" are included exactly as in the original, and
  24. provided that the entire resulting derived work is distributed under
  25. the terms of a permission notice identical to this one.
  26.  
  27.    Permission is granted to copy and distribute translations of this
  28. manual into another language, under the above conditions for modified
  29. versions, except that the sections entitled "GNU General Public
  30. License" and "Funding for Free Software", and this permission notice,
  31. may be included in translations approved by the Free Software Foundation
  32. instead of in the original English.
  33.  
  34. 
  35. File: gcc.info,  Node: Installation Problems,  Next: Cross-Compiler Problems,  Prev: Actual Bugs,  Up: Trouble
  36.  
  37. Installation Problems
  38. =====================
  39.  
  40.    This is a list of problems (and some apparent problems which don't
  41. really mean anything is wrong) that show up during installation of GNU
  42. CC.
  43.  
  44.    * On certain systems, defining certain environment variables such as
  45.      `CC' can interfere with the functioning of `make'.
  46.  
  47.    * If you encounter seemingly strange errors when trying to build the
  48.      compiler in a directory other than the source directory, it could
  49.      be because you have previously configured the compiler in the
  50.      source directory.  Make sure you have done all the necessary
  51.      preparations.  *Note Other Dir::.
  52.  
  53.    * If you build GCC on a BSD system using a directory stored in a
  54.      System V file system, problems may occur in running `fixincludes'
  55.      if the System V file system doesn't support symbolic links.  These
  56.      problems result in a failure to fix the declaration of `size_t' in
  57.      `sys/types.h'.  If you find that `size_t' is a signed type and
  58.      that type mismatches occur, this could be the cause.
  59.  
  60.      The solution is not to use such a directory for building GCC.
  61.  
  62.    * In previous versions of GCC, the `gcc' driver program looked for
  63.      `as' and `ld' in various places; for example, in files beginning
  64.      with `/usr/local/lib/gcc-'.  GCC version 2 looks for them in the
  65.      directory `/usr/local/lib/gcc-lib/TARGET/VERSION'.
  66.  
  67.      Thus, to use a version of `as' or `ld' that is not the system
  68.      default, for example `gas' or GNU `ld', you must put them in that
  69.      directory (or make links to them from that directory).
  70.  
  71.    * Some commands executed when making the compiler may fail (return a
  72.      non-zero status) and be ignored by `make'.  These failures, which
  73.      are often due to files that were not found, are expected, and can
  74.      safely be ignored.
  75.  
  76.    * It is normal to have warnings in compiling certain files about
  77.      unreachable code and about enumeration type clashes.  These files'
  78.      names begin with `insn-'.  Also, `real.c' may get some warnings
  79.      that you can ignore.
  80.  
  81.    * Sometimes `make' recompiles parts of the compiler when installing
  82.      the compiler.  In one case, this was traced down to a bug in
  83.      `make'.  Either ignore the problem or switch to GNU Make.
  84.  
  85.    * If you have installed a program known as purify, you may find that
  86.      it causes errors while linking `enquire', which is part of building
  87.      GCC.  The fix is to get rid of the file `real-ld' which purify
  88.      installs--so that GCC won't try to use it.
  89.  
  90.    * On GNU/Linux SLS 1.01, there is a problem with `libc.a': it does
  91.      not contain the obstack functions.  However, GCC assumes that the
  92.      obstack functions are in `libc.a' when it is the GNU C library.
  93.      To work around this problem, change the `__GNU_LIBRARY__'
  94.      conditional around line 31 to `#if 1'.
  95.  
  96.    * On some 386 systems, building the compiler never finishes because
  97.      `enquire' hangs due to a hardware problem in the motherboard--it
  98.      reports floating point exceptions to the kernel incorrectly.  You
  99.      can install GCC except for `float.h' by patching out the command to
  100.      run `enquire'.  You may also be able to fix the problem for real by
  101.      getting a replacement motherboard.  This problem was observed in
  102.      Revision E of the Micronics motherboard, and is fixed in Revision
  103.      F.  It has also been observed in the MYLEX MXA-33 motherboard.
  104.  
  105.      If you encounter this problem, you may also want to consider
  106.      removing the FPU from the socket during the compilation.
  107.      Alternatively, if you are running SCO Unix, you can reboot and
  108.      force the FPU to be ignored.  To do this, type `hd(40)unix auto
  109.      ignorefpu'.
  110.  
  111.    * On some 386 systems, GCC crashes trying to compile `enquire.c'.
  112.      This happens on machines that don't have a 387 FPU chip.  On 386
  113.      machines, the system kernel is supposed to emulate the 387 when you
  114.      don't have one.  The crash is due to a bug in the emulator.
  115.  
  116.      One of these systems is the Unix from Interactive Systems: 386/ix.
  117.      On this system, an alternate emulator is provided, and it does
  118.      work.  To use it, execute this command as super-user:
  119.  
  120.           ln /etc/emulator.rel1 /etc/emulator
  121.  
  122.      and then reboot the system.  (The default emulator file remains
  123.      present under the name `emulator.dflt'.)
  124.  
  125.      Try using `/etc/emulator.att', if you have such a problem on the
  126.      SCO system.
  127.  
  128.      Another system which has this problem is Esix.  We don't know
  129.      whether it has an alternate emulator that works.
  130.  
  131.      On NetBSD 0.8, a similar problem manifests itself as these error
  132.      messages:
  133.  
  134.           enquire.c: In function `fprop':
  135.           enquire.c:2328: floating overflow
  136.  
  137.    * On SCO systems, when compiling GCC with the system's compiler, do
  138.      not use `-O'.  Some versions of the system's compiler miscompile
  139.      GCC with `-O'.
  140.  
  141.    * Sometimes on a Sun 4 you may observe a crash in the program
  142.      `genflags' or `genoutput' while building GCC.  This is said to be
  143.      due to a bug in `sh'.  You can probably get around it by running
  144.      `genflags' or `genoutput' manually and then retrying the `make'.
  145.  
  146.    * On Solaris 2, executables of GCC version 2.0.2 are commonly
  147.      available, but they have a bug that shows up when compiling current
  148.      versions of GCC: undefined symbol errors occur during assembly if
  149.      you use `-g'.
  150.  
  151.      The solution is to compile the current version of GCC without
  152.      `-g'.  That makes a working compiler which you can use to recompile
  153.      with `-g'.
  154.  
  155.    * Solaris 2 comes with a number of optional OS packages.  Some of
  156.      these packages are needed to use GCC fully.  If you did not
  157.      install all optional packages when installing Solaris, you will
  158.      need to verify that the packages that GCC needs are installed.
  159.  
  160.      To check whether an optional package is installed, use the
  161.      `pkginfo' command.  To add an optional package, use the `pkgadd'
  162.      command.  For further details, see the Solaris documentation.
  163.  
  164.      For Solaris 2.0 and 2.1, GCC needs six packages: `SUNWarc',
  165.      `SUNWbtool', `SUNWesu', `SUNWhea', `SUNWlibm', and `SUNWtoo'.
  166.  
  167.      For Solaris 2.2, GCC needs an additional seventh package:
  168.      `SUNWsprot'.
  169.  
  170.    * On Solaris 2, trying to use the linker and other tools in
  171.      `/usr/ucb' to install GCC has been observed to cause trouble.  For
  172.      example, the linker may hang indefinitely.  The fix is to remove
  173.      `/usr/ucb' from your `PATH'.
  174.  
  175.    * If you use the 1.31 version of the MIPS assembler (such as was
  176.      shipped with Ultrix 3.1), you will need to use the
  177.      -fno-delayed-branch switch when optimizing floating point code.
  178.      Otherwise, the assembler will complain when the GCC compiler fills
  179.      a branch delay slot with a floating point instruction, such as
  180.      `add.d'.
  181.  
  182.    * If on a MIPS system you get an error message saying "does not have
  183.      gp sections for all it's [sic] sectons [sic]", don't worry about
  184.      it.  This happens whenever you use GAS with the MIPS linker, but
  185.      there is not really anything wrong, and it is okay to use the
  186.      output file.  You can stop such warnings by installing the GNU
  187.      linker.
  188.  
  189.      It would be nice to extend GAS to produce the gp tables, but they
  190.      are optional, and there should not be a warning about their
  191.      absence.
  192.  
  193.    * In Ultrix 4.0 on the MIPS machine, `stdio.h' does not work with GNU
  194.      CC at all unless it has been fixed with `fixincludes'.  This causes
  195.      problems in building GCC.  Once GCC is installed, the problems go
  196.      away.
  197.  
  198.      To work around this problem, when making the stage 1 compiler,
  199.      specify this option to Make:
  200.  
  201.           GCC_FOR_TARGET="./xgcc -B./ -I./include"
  202.  
  203.      When making stage 2 and stage 3, specify this option:
  204.  
  205.           CFLAGS="-g -I./include"
  206.  
  207.    * Users have reported some problems with version 2.0 of the MIPS
  208.      compiler tools that were shipped with Ultrix 4.1.  Version 2.10
  209.      which came with Ultrix 4.2 seems to work fine.
  210.  
  211.      Users have also reported some problems with version 2.20 of the
  212.      MIPS compiler tools that were shipped with RISC/os 4.x.  The
  213.      earlier version 2.11 seems to work fine.
  214.  
  215.    * Some versions of the MIPS linker will issue an assertion failure
  216.      when linking code that uses `alloca' against shared libraries on
  217.      RISC-OS 5.0, and DEC's OSF/1 systems.  This is a bug in the
  218.      linker, that is supposed to be fixed in future revisions.  To
  219.      protect against this, GCC passes `-non_shared' to the linker
  220.      unless you pass an explicit `-shared' or `-call_shared' switch.
  221.  
  222.    * On System V release 3, you may get this error message while
  223.      linking:
  224.  
  225.           ld fatal: failed to write symbol name SOMETHING
  226.            in strings table for file WHATEVER
  227.  
  228.      This probably indicates that the disk is full or your ULIMIT won't
  229.      allow the file to be as large as it needs to be.
  230.  
  231.      This problem can also result because the kernel parameter `MAXUMEM'
  232.      is too small.  If so, you must regenerate the kernel and make the
  233.      value much larger.  The default value is reported to be 1024; a
  234.      value of 32768 is said to work.  Smaller values may also work.
  235.  
  236.    * On System V, if you get an error like this,
  237.  
  238.           /usr/local/lib/bison.simple: In function `yyparse':
  239.           /usr/local/lib/bison.simple:625: virtual memory exhausted
  240.  
  241.      that too indicates a problem with disk space, ULIMIT, or `MAXUMEM'.
  242.  
  243.    * Current GCC versions probably do not work on version 2 of the NeXT
  244.      operating system.
  245.  
  246.    * On NeXTStep 3.0, the Objective C compiler does not work, due,
  247.      apparently, to a kernel bug that it happens to trigger.  This
  248.      problem does not happen on 3.1.
  249.  
  250.    * On the Tower models 4N0 and 6N0, by default a process is not
  251.      allowed to have more than one megabyte of memory.  GCC cannot
  252.      compile itself (or many other programs) with `-O' in that much
  253.      memory.
  254.  
  255.      To solve this problem, reconfigure the kernel adding the following
  256.      line to the configuration file:
  257.  
  258.           MAXUMEM = 4096
  259.  
  260.    * On HP 9000 series 300 or 400 running HP-UX release 8.0, there is a
  261.      bug in the assembler that must be fixed before GCC can be built.
  262.      This bug manifests itself during the first stage of compilation,
  263.      while building `libgcc2.a':
  264.  
  265.           _floatdisf
  266.           cc1: warning: `-g' option not supported on this version of GCC
  267.           cc1: warning: `-g1' option not supported on this version of GCC
  268.           ./xgcc: Internal compiler error: program as got fatal signal 11
  269.  
  270.      A patched version of the assembler is available by anonymous ftp
  271.      from `altdorf.ai.mit.edu' as the file
  272.      `archive/cph/hpux-8.0-assembler'.  If you have HP software support,
  273.      the patch can also be obtained directly from HP, as described in
  274.      the following note:
  275.  
  276.           This is the patched assembler, to patch SR#1653-010439, where
  277.           the assembler aborts on floating point constants.
  278.  
  279.           The bug is not really in the assembler, but in the shared
  280.           library version of the function "cvtnum(3c)".  The bug on
  281.           "cvtnum(3c)" is SR#4701-078451.  Anyway, the attached
  282.           assembler uses the archive library version of "cvtnum(3c)"
  283.           and thus does not exhibit the bug.
  284.  
  285.      This patch is also known as PHCO_4484.
  286.  
  287.    * On HP-UX version 8.05, but not on 8.07 or more recent versions,
  288.      the `fixproto' shell script triggers a bug in the system shell.
  289.      If you encounter this problem, upgrade your operating system or
  290.      use BASH (the GNU shell) to run `fixproto'.
  291.  
  292.    * Some versions of the Pyramid C compiler are reported to be unable
  293.      to compile GCC.  You must use an older version of GCC for
  294.      bootstrapping.  One indication of this problem is if you get a
  295.      crash when GCC compiles the function `muldi3' in file `libgcc2.c'.
  296.  
  297.      You may be able to succeed by getting GCC version 1, installing it,
  298.      and using it to compile GCC version 2.  The bug in the Pyramid C
  299.      compiler does not seem to affect GCC version 1.
  300.  
  301.    * There may be similar problems on System V Release 3.1 on 386
  302.      systems.
  303.  
  304.    * On the Intel Paragon (an i860 machine), if you are using operating
  305.      system version 1.0, you will get warnings or errors about
  306.      redefinition of `va_arg' when you build GCC.
  307.  
  308.      If this happens, then you need to link most programs with the
  309.      library `iclib.a'.  You must also modify `stdio.h' as follows:
  310.      before the lines
  311.  
  312.           #if     defined(__i860__) && !defined(_VA_LIST)
  313.           #include <va_list.h>
  314.  
  315.      insert the line
  316.  
  317.           #if __PGC__
  318.  
  319.      and after the lines
  320.  
  321.           extern int  vprintf(const char *, va_list );
  322.           extern int  vsprintf(char *, const char *, va_list );
  323.           #endif
  324.  
  325.      insert the line
  326.  
  327.           #endif /* __PGC__ */
  328.  
  329.      These problems don't exist in operating system version 1.1.
  330.  
  331.    * On the Altos 3068, programs compiled with GCC won't work unless you
  332.      fix a kernel bug.  This happens using system versions V.2.2 1.0gT1
  333.      and V.2.2 1.0e and perhaps later versions as well.  See the file
  334.      `README.ALTOS'.
  335.  
  336.    * You will get several sorts of compilation and linking errors on the
  337.      we32k if you don't follow the special instructions.  *Note
  338.      Configurations::.
  339.  
  340.    * A bug in the HP-UX 8.05 (and earlier) shell will cause the fixproto
  341.      program to report an error of the form:
  342.  
  343.           ./fixproto: sh internal 1K buffer overflow
  344.  
  345.      To fix this, change the first line of the fixproto script to look
  346.      like:
  347.  
  348.           #!/bin/ksh
  349.  
  350. 
  351. File: gcc.info,  Node: Cross-Compiler Problems,  Next: Interoperation,  Prev: Installation Problems,  Up: Trouble
  352.  
  353. Cross-Compiler Problems
  354. =======================
  355.  
  356.    You may run into problems with cross compilation on certain machines,
  357. for several reasons.
  358.  
  359.    * Cross compilation can run into trouble for certain machines because
  360.      some target machines' assemblers require floating point numbers to
  361.      be written as *integer* constants in certain contexts.
  362.  
  363.      The compiler writes these integer constants by examining the
  364.      floating point value as an integer and printing that integer,
  365.      because this is simple to write and independent of the details of
  366.      the floating point representation.  But this does not work if the
  367.      compiler is running on a different machine with an incompatible
  368.      floating point format, or even a different byte-ordering.
  369.  
  370.      In addition, correct constant folding of floating point values
  371.      requires representing them in the target machine's format.  (The C
  372.      standard does not quite require this, but in practice it is the
  373.      only way to win.)
  374.  
  375.      It is now possible to overcome these problems by defining macros
  376.      such as `REAL_VALUE_TYPE'.  But doing so is a substantial amount of
  377.      work for each target machine.  *Note Cross-compilation::.
  378.  
  379.    * At present, the program `mips-tfile' which adds debug support to
  380.      object files on MIPS systems does not work in a cross compile
  381.      environment.
  382.  
  383. 
  384. File: gcc.info,  Node: Interoperation,  Next: External Bugs,  Prev: Cross-Compiler Problems,  Up: Trouble
  385.  
  386. Interoperation
  387. ==============
  388.  
  389.    This section lists various difficulties encountered in using GNU C or
  390. GNU C++ together with other compilers or with the assemblers, linkers,
  391. libraries and debuggers on certain systems.
  392.  
  393.    * Objective C does not work on the RS/6000.
  394.  
  395.    * GNU C++ does not do name mangling in the same way as other C++
  396.      compilers.  This means that object files compiled with one compiler
  397.      cannot be used with another.
  398.  
  399.      This effect is intentional, to protect you from more subtle
  400.      problems.  Compilers differ as to many internal details of C++
  401.      implementation, including: how class instances are laid out, how
  402.      multiple inheritance is implemented, and how virtual function
  403.      calls are handled.  If the name encoding were made the same, your
  404.      programs would link against libraries provided from other
  405.      compilers--but the programs would then crash when run.
  406.      Incompatible libraries are then detected at link time, rather than
  407.      at run time.
  408.  
  409.    * Older GDB versions sometimes fail to read the output of GCC version
  410.      2.  If you have trouble, get GDB version 4.4 or later.
  411.  
  412.    * DBX rejects some files produced by GCC, though it accepts similar
  413.      constructs in output from PCC.  Until someone can supply a coherent
  414.      description of what is valid DBX input and what is not, there is
  415.      nothing I can do about these problems.  You are on your own.
  416.  
  417.    * The GNU assembler (GAS) does not support PIC.  To generate PIC
  418.      code, you must use some other assembler, such as `/bin/as'.
  419.  
  420.    * On some BSD systems, including some versions of Ultrix, use of
  421.      profiling causes static variable destructors (currently used only
  422.      in C++) not to be run.
  423.  
  424.    * Use of `-I/usr/include' may cause trouble.
  425.  
  426.      Many systems come with header files that won't work with GCC unless
  427.      corrected by `fixincludes'.  The corrected header files go in a new
  428.      directory; GCC searches this directory before `/usr/include'.  If
  429.      you use `-I/usr/include', this tells GCC to search `/usr/include'
  430.      earlier on, before the corrected headers.  The result is that you
  431.      get the uncorrected header files.
  432.  
  433.      Instead, you should use these options (when compiling C programs):
  434.  
  435.           -I/usr/local/lib/gcc-lib/TARGET/VERSION/include -I/usr/include
  436.  
  437.      For C++ programs, GCC also uses a special directory that defines
  438.      C++ interfaces to standard C subroutines.  This directory is meant
  439.      to be searched *before* other standard include directories, so
  440.      that it takes precedence.  If you are compiling C++ programs and
  441.      specifying include directories explicitly, use this option first,
  442.      then the two options above:
  443.  
  444.           -I/usr/local/lib/g++-include
  445.  
  446.    * On some SGI systems, when you use `-lgl_s' as an option, it gets
  447.      translated magically to `-lgl_s -lX11_s -lc_s'.  Naturally, this
  448.      does not happen when you use GCC.  You must specify all three
  449.      options explicitly.
  450.  
  451.    * On a Sparc, GCC aligns all values of type `double' on an 8-byte
  452.      boundary, and it expects every `double' to be so aligned.  The Sun
  453.      compiler usually gives `double' values 8-byte alignment, with one
  454.      exception: function arguments of type `double' may not be aligned.
  455.  
  456.      As a result, if a function compiled with Sun CC takes the address
  457.      of an argument of type `double' and passes this pointer of type
  458.      `double *' to a function compiled with GCC, dereferencing the
  459.      pointer may cause a fatal signal.
  460.  
  461.      One way to solve this problem is to compile your entire program
  462.      with GNU CC.  Another solution is to modify the function that is
  463.      compiled with Sun CC to copy the argument into a local variable;
  464.      local variables are always properly aligned.  A third solution is
  465.      to modify the function that uses the pointer to dereference it via
  466.      the following function `access_double' instead of directly with
  467.      `*':
  468.  
  469.           inline double
  470.           access_double (double *unaligned_ptr)
  471.           {
  472.             union d2i { double d; int i[2]; };
  473.           
  474.             union d2i *p = (union d2i *) unaligned_ptr;
  475.             union d2i u;
  476.           
  477.             u.i[0] = p->i[0];
  478.             u.i[1] = p->i[1];
  479.           
  480.             return u.d;
  481.           }
  482.  
  483.      Storing into the pointer can be done likewise with the same union.
  484.  
  485.    * On Solaris, the `malloc' function in the `libmalloc.a' library may
  486.      allocate memory that is only 4 byte aligned.  Since GCC on the
  487.      Sparc assumes that doubles are 8 byte aligned, this may result in a
  488.      fatal signal if doubles are stored in memory allocated by the
  489.      `libmalloc.a' library.
  490.  
  491.      The solution is to not use the `libmalloc.a' library.  Use instead
  492.      `malloc' and related functions from `libc.a'; they do not have
  493.      this problem.
  494.  
  495.    * Sun forgot to include a static version of `libdl.a' with some
  496.      versions of SunOS (mainly 4.1).  This results in undefined symbols
  497.      when linking static binaries (that is, if you use `-static').  If
  498.      you see undefined symbols `_dlclose', `_dlsym' or `_dlopen' when
  499.      linking, compile and link against the file `mit/util/misc/dlsym.c'
  500.      from the MIT version of X windows.
  501.  
  502.    * The 128-bit long double format that the Sparc port supports
  503.      currently works by using the architecturally defined quad-word
  504.      floating point instructions.  Since there is no hardware that
  505.      supports these instructions they must be emulated by the operating
  506.      system.  Long doubles do not work in Sun OS versions 4.0.3 and
  507.      earlier, because the kernel emulator uses an obsolete and
  508.      incompatible format.  Long doubles do not work in Sun OS version
  509.      4.1.1 due to a problem in a Sun library.  Long doubles do work on
  510.      Sun OS versions 4.1.2 and higher, but GCC does not enable them by
  511.      default.  Long doubles appear to work in Sun OS 5.x (Solaris 2.x).
  512.  
  513.    * On HP-UX version 9.01 on the HP PA, the HP compiler `cc' does not
  514.      compile GCC correctly.  We do not yet know why.  However, GCC
  515.      compiled on earlier HP-UX versions works properly on HP-UX 9.01
  516.      and can compile itself properly on 9.01.
  517.  
  518.    * On the HP PA machine, ADB sometimes fails to work on functions
  519.      compiled with GCC.  Specifically, it fails to work on functions
  520.      that use `alloca' or variable-size arrays.  This is because GCC
  521.      doesn't generate HP-UX unwind descriptors for such functions.  It
  522.      may even be impossible to generate them.
  523.  
  524.    * Debugging (`-g') is not supported on the HP PA machine, unless you
  525.      use the preliminary GNU tools (*note Installation::.).
  526.  
  527.    * Taking the address of a label may generate errors from the HP-UX
  528.      PA assembler.  GAS for the PA does not have this problem.
  529.  
  530.    * Using floating point parameters for indirect calls to static
  531.      functions will not work when using the HP assembler.  There simply
  532.      is no way for GCC to specify what registers hold arguments for
  533.      static functions when using the HP assembler.  GAS for the PA does
  534.      not have this problem.
  535.  
  536.    * In extremely rare cases involving some very large functions you may
  537.      receive errors from the HP linker complaining about an out of
  538.      bounds unconditional branch offset.  This used to occur more often
  539.      in previous versions of GCC, but is now exceptionally rare.  If
  540.      you should run into it, you can work around by making your
  541.      function smaller.
  542.  
  543.    * GCC compiled code sometimes emits warnings from the HP-UX
  544.      assembler of the form:
  545.  
  546.           (warning) Use of GR3 when
  547.             frame >= 8192 may cause conflict.
  548.  
  549.      These warnings are harmless and can be safely ignored.
  550.  
  551.    * The current version of the assembler (`/bin/as') for the RS/6000
  552.      has certain problems that prevent the `-g' option in GCC from
  553.      working.  Note that `Makefile.in' uses `-g' by default when
  554.      compiling `libgcc2.c'.
  555.  
  556.      IBM has produced a fixed version of the assembler.  The upgraded
  557.      assembler unfortunately was not included in any of the AIX 3.2
  558.      update PTF releases (3.2.2, 3.2.3, or 3.2.3e).  Users of AIX 3.1
  559.      should request PTF U403044 from IBM and users of AIX 3.2 should
  560.      request PTF U416277.  See the file `README.RS6000' for more
  561.      details on these updates.
  562.  
  563.      You can test for the presense of a fixed assembler by using the
  564.      command
  565.  
  566.           as -u < /dev/null
  567.  
  568.      If the command exits normally, the assembler fix already is
  569.      installed.  If the assembler complains that "-u" is an unknown
  570.      flag, you need to order the fix.
  571.  
  572.    * On the IBM RS/6000, compiling code of the form
  573.  
  574.           extern int foo;
  575.           
  576.           ... foo ...
  577.           
  578.           static int foo;
  579.  
  580.      will cause the linker to report an undefined symbol `foo'.
  581.      Although this behavior differs from most other systems, it is not a
  582.      bug because redefining an `extern' variable as `static' is
  583.      undefined in ANSI C.
  584.  
  585.    * AIX on the RS/6000 provides support (NLS) for environments outside
  586.      of the United States.  Compilers and assemblers use NLS to support
  587.      locale-specific representations of various objects including
  588.      floating-point numbers ("." vs "," for separating decimal
  589.      fractions).  There have been problems reported where the library
  590.      linked with GCC does not produce the same floating-point formats
  591.      that the assembler accepts.  If you have this problem, set the
  592.      LANG environment variable to "C" or "En_US".
  593.  
  594.    * Even if you specify `-fdollars-in-identifiers', you cannot
  595.      successfully use `$' in identifiers on the RS/6000 due to a
  596.      restriction in the IBM assembler.  GAS supports these identifiers.
  597.  
  598.    * On the RS/6000, XLC version 1.3.0.0 will miscompile `jump.c'.  XLC
  599.      version 1.3.0.1 or later fixes this problem.  You can obtain
  600.      XLC-1.3.0.2 by requesting PTF 421749 from IBM.
  601.  
  602.    * There is an assembler bug in versions of DG/UX prior to 5.4.2.01
  603.      that occurs when the `fldcr' instruction is used.  GCC uses
  604.      `fldcr' on the 88100 to serialize volatile memory references.  Use
  605.      the option `-mno-serialize-volatile' if your version of the
  606.      assembler has this bug.
  607.  
  608.    * On VMS, GAS versions 1.38.1 and earlier may cause spurious warning
  609.      messages from the linker.  These warning messages complain of
  610.      mismatched psect attributes.  You can ignore them.  *Note VMS
  611.      Install::.
  612.  
  613.    * On NewsOS version 3, if you include both of the files `stddef.h'
  614.      and `sys/types.h', you get an error because there are two typedefs
  615.      of `size_t'.  You should change `sys/types.h' by adding these
  616.      lines around the definition of `size_t':
  617.  
  618.           #ifndef _SIZE_T
  619.           #define _SIZE_T
  620.           ACTUAL TYPEDEF HERE
  621.           #endif
  622.  
  623.    * On the Alliant, the system's own convention for returning
  624.      structures and unions is unusual, and is not compatible with GCC
  625.      no matter what options are used.
  626.  
  627.    * On the IBM RT PC, the MetaWare HighC compiler (hc) uses a different
  628.      convention for structure and union returning.  Use the option
  629.      `-mhc-struct-return' to tell GCC to use a convention compatible
  630.      with it.
  631.  
  632.    * On Ultrix, the Fortran compiler expects registers 2 through 5 to
  633.      be saved by function calls.  However, the C compiler uses
  634.      conventions compatible with BSD Unix: registers 2 through 5 may be
  635.      clobbered by function calls.
  636.  
  637.      GCC uses the same convention as the Ultrix C compiler.  You can use
  638.      these options to produce code compatible with the Fortran compiler:
  639.  
  640.           -fcall-saved-r2 -fcall-saved-r3 -fcall-saved-r4 -fcall-saved-r5
  641.  
  642.    * On the WE32k, you may find that programs compiled with GCC do not
  643.      work with the standard shared C library.  You may need to link with
  644.      the ordinary C compiler.  If you do so, you must specify the
  645.      following options:
  646.  
  647.           -L/usr/local/lib/gcc-lib/we32k-att-sysv/2.8.1 -lgcc -lc_s
  648.  
  649.      The first specifies where to find the library `libgcc.a' specified
  650.      with the `-lgcc' option.
  651.  
  652.      GCC does linking by invoking `ld', just as `cc' does, and there is
  653.      no reason why it *should* matter which compilation program you use
  654.      to invoke `ld'.  If someone tracks this problem down, it can
  655.      probably be fixed easily.
  656.  
  657.    * On the Alpha, you may get assembler errors about invalid syntax as
  658.      a result of floating point constants.  This is due to a bug in the
  659.      C library functions `ecvt', `fcvt' and `gcvt'.  Given valid
  660.      floating point numbers, they sometimes print `NaN'.
  661.  
  662.    * On Irix 4.0.5F (and perhaps in some other versions), an assembler
  663.      bug sometimes reorders instructions incorrectly when optimization
  664.      is turned on.  If you think this may be happening to you, try
  665.      using the GNU assembler; GAS version 2.1 supports ECOFF on Irix.
  666.  
  667.      Or use the `-noasmopt' option when you compile GCC with itself,
  668.      and then again when you compile your program.  (This is a temporary
  669.      kludge to turn off assembler optimization on Irix.)  If this
  670.      proves to be what you need, edit the assembler spec in the file
  671.      `specs' so that it unconditionally passes `-O0' to the assembler,
  672.      and never passes `-O2' or `-O3'.
  673.  
  674. 
  675. File: gcc.info,  Node: External Bugs,  Next: Incompatibilities,  Prev: Interoperation,  Up: Trouble
  676.  
  677. Problems Compiling Certain Programs
  678. ===================================
  679.  
  680.    Certain programs have problems compiling.
  681.  
  682.    * Parse errors may occur compiling X11 on a Decstation running
  683.      Ultrix 4.2 because of problems in DEC's versions of the X11 header
  684.      files `X11/Xlib.h' and `X11/Xutil.h'.  People recommend adding
  685.      `-I/usr/include/mit' to use the MIT versions of the header files,
  686.      using the `-traditional' switch to turn off ANSI C, or fixing the
  687.      header files by adding this:
  688.  
  689.           #ifdef __STDC__
  690.           #define NeedFunctionPrototypes 0
  691.           #endif
  692.  
  693.    * If you have trouble compiling Perl on a SunOS 4 system, it may be
  694.      because Perl specifies `-I/usr/ucbinclude'.  This accesses the
  695.      unfixed header files.  Perl specifies the options
  696.  
  697.           -traditional -Dvolatile=__volatile__
  698.           -I/usr/include/sun -I/usr/ucbinclude
  699.           -fpcc-struct-return
  700.  
  701.      most of which are unnecessary with GCC 2.4.5 and newer versions.
  702.      You can make a properly working Perl by setting `ccflags' to
  703.      `-fwritable-strings' (implied by the `-traditional' in the
  704.      original options) and `cppflags' to empty in `config.sh', then
  705.      typing `./doSH; make depend; make'.
  706.  
  707.    * On various 386 Unix systems derived from System V, including SCO,
  708.      ISC, and ESIX, you may get error messages about running out of
  709.      virtual memory while compiling certain programs.
  710.  
  711.      You can prevent this problem by linking GCC with the GNU malloc
  712.      (which thus replaces the malloc that comes with the system).  GNU
  713.      malloc is available as a separate package, and also in the file
  714.      `src/gmalloc.c' in the GNU Emacs 19 distribution.
  715.  
  716.      If you have installed GNU malloc as a separate library package,
  717.      use this option when you relink GCC:
  718.  
  719.           MALLOC=/usr/local/lib/libgmalloc.a
  720.  
  721.      Alternatively, if you have compiled `gmalloc.c' from Emacs 19, copy
  722.      the object file to `gmalloc.o' and use this option when you relink
  723.      GCC:
  724.  
  725.           MALLOC=gmalloc.o
  726.  
  727. 
  728. File: gcc.info,  Node: Incompatibilities,  Next: Fixed Headers,  Prev: External Bugs,  Up: Trouble
  729.  
  730. Incompatibilities of GCC
  731. ========================
  732.  
  733.    There are several noteworthy incompatibilities between GNU C and most
  734. existing (non-ANSI) versions of C.  The `-traditional' option
  735. eliminates many of these incompatibilities, *but not all*, by telling
  736. GNU C to behave like the other C compilers.
  737.  
  738.    * GCC normally makes string constants read-only.  If several
  739.      identical-looking string constants are used, GCC stores only one
  740.      copy of the string.
  741.  
  742.      One consequence is that you cannot call `mktemp' with a string
  743.      constant argument.  The function `mktemp' always alters the string
  744.      its argument points to.
  745.  
  746.      Another consequence is that `sscanf' does not work on some systems
  747.      when passed a string constant as its format control string or
  748.      input.  This is because `sscanf' incorrectly tries to write into
  749.      the string constant.  Likewise `fscanf' and `scanf'.
  750.  
  751.      The best solution to these problems is to change the program to use
  752.      `char'-array variables with initialization strings for these
  753.      purposes instead of string constants.  But if this is not possible,
  754.      you can use the `-fwritable-strings' flag, which directs GCC to
  755.      handle string constants the same way most C compilers do.
  756.      `-traditional' also has this effect, among others.
  757.  
  758.    * `-2147483648' is positive.
  759.  
  760.      This is because 2147483648 cannot fit in the type `int', so
  761.      (following the ANSI C rules) its data type is `unsigned long int'.
  762.      Negating this value yields 2147483648 again.
  763.  
  764.    * GCC does not substitute macro arguments when they appear inside of
  765.      string constants.  For example, the following macro in GCC
  766.  
  767.           #define foo(a) "a"
  768.  
  769.      will produce output `"a"' regardless of what the argument A is.
  770.  
  771.      The `-traditional' option directs GCC to handle such cases (among
  772.      others) in the old-fashioned (non-ANSI) fashion.
  773.  
  774.    * When you use `setjmp' and `longjmp', the only automatic variables
  775.      guaranteed to remain valid are those declared `volatile'.  This is
  776.      a consequence of automatic register allocation.  Consider this
  777.      function:
  778.  
  779.           jmp_buf j;
  780.           
  781.           foo ()
  782.           {
  783.             int a, b;
  784.           
  785.             a = fun1 ();
  786.             if (setjmp (j))
  787.               return a;
  788.           
  789.             a = fun2 ();
  790.             /* `longjmp (j)' may occur in `fun3'. */
  791.             return a + fun3 ();
  792.           }
  793.  
  794.      Here `a' may or may not be restored to its first value when the
  795.      `longjmp' occurs.  If `a' is allocated in a register, then its
  796.      first value is restored; otherwise, it keeps the last value stored
  797.      in it.
  798.  
  799.      If you use the `-W' option with the `-O' option, you will get a
  800.      warning when GCC thinks such a problem might be possible.
  801.  
  802.      The `-traditional' option directs GNU C to put variables in the
  803.      stack by default, rather than in registers, in functions that call
  804.      `setjmp'.  This results in the behavior found in traditional C
  805.      compilers.
  806.  
  807.    * Programs that use preprocessing directives in the middle of macro
  808.      arguments do not work with GCC.  For example, a program like this
  809.      will not work:
  810.  
  811.           foobar (
  812.           #define luser
  813.                   hack)
  814.  
  815.      ANSI C does not permit such a construct.  It would make sense to
  816.      support it when `-traditional' is used, but it is too much work to
  817.      implement.
  818.  
  819.    * Declarations of external variables and functions within a block
  820.      apply only to the block containing the declaration.  In other
  821.      words, they have the same scope as any other declaration in the
  822.      same place.
  823.  
  824.      In some other C compilers, a `extern' declaration affects all the
  825.      rest of the file even if it happens within a block.
  826.  
  827.      The `-traditional' option directs GNU C to treat all `extern'
  828.      declarations as global, like traditional compilers.
  829.  
  830.    * In traditional C, you can combine `long', etc., with a typedef
  831.      name, as shown here:
  832.  
  833.           typedef int foo;
  834.           typedef long foo bar;
  835.  
  836.      In ANSI C, this is not allowed: `long' and other type modifiers
  837.      require an explicit `int'.  Because this criterion is expressed by
  838.      Bison grammar rules rather than C code, the `-traditional' flag
  839.      cannot alter it.
  840.  
  841.    * PCC allows typedef names to be used as function parameters.  The
  842.      difficulty described immediately above applies here too.
  843.  
  844.    * PCC allows whitespace in the middle of compound assignment
  845.      operators such as `+='.  GCC, following the ANSI standard, does not
  846.      allow this.  The difficulty described immediately above applies
  847.      here too.
  848.  
  849.    * GCC complains about unterminated character constants inside of
  850.      preprocessing conditionals that fail.  Some programs have English
  851.      comments enclosed in conditionals that are guaranteed to fail; if
  852.      these comments contain apostrophes, GCC will probably report an
  853.      error.  For example, this code would produce an error:
  854.  
  855.           #if 0
  856.           You can't expect this to work.
  857.           #endif
  858.  
  859.      The best solution to such a problem is to put the text into an
  860.      actual C comment delimited by `/*...*/'.  However, `-traditional'
  861.      suppresses these error messages.
  862.  
  863.    * Many user programs contain the declaration `long time ();'.  In the
  864.      past, the system header files on many systems did not actually
  865.      declare `time', so it did not matter what type your program
  866.      declared it to return.  But in systems with ANSI C headers, `time'
  867.      is declared to return `time_t', and if that is not the same as
  868.      `long', then `long time ();' is erroneous.
  869.  
  870.      The solution is to change your program to use `time_t' as the
  871.      return type of `time'.
  872.  
  873.    * When compiling functions that return `float', PCC converts it to a
  874.      double.  GCC actually returns a `float'.  If you are concerned
  875.      with PCC compatibility, you should declare your functions to return
  876.      `double'; you might as well say what you mean.
  877.  
  878.    * When compiling functions that return structures or unions, GCC
  879.      output code normally uses a method different from that used on most
  880.      versions of Unix.  As a result, code compiled with GCC cannot call
  881.      a structure-returning function compiled with PCC, and vice versa.
  882.  
  883.      The method used by GCC is as follows: a structure or union which is
  884.      1, 2, 4 or 8 bytes long is returned like a scalar.  A structure or
  885.      union with any other size is stored into an address supplied by
  886.      the caller (usually in a special, fixed register, but on some
  887.      machines it is passed on the stack).  The machine-description
  888.      macros `STRUCT_VALUE' and `STRUCT_INCOMING_VALUE' tell GCC where
  889.      to pass this address.
  890.  
  891.      By contrast, PCC on most target machines returns structures and
  892.      unions of any size by copying the data into an area of static
  893.      storage, and then returning the address of that storage as if it
  894.      were a pointer value.  The caller must copy the data from that
  895.      memory area to the place where the value is wanted.  GCC does not
  896.      use this method because it is slower and nonreentrant.
  897.  
  898.      On some newer machines, PCC uses a reentrant convention for all
  899.      structure and union returning.  GCC on most of these machines uses
  900.      a compatible convention when returning structures and unions in
  901.      memory, but still returns small structures and unions in registers.
  902.  
  903.      You can tell GCC to use a compatible convention for all structure
  904.      and union returning with the option `-fpcc-struct-return'.
  905.  
  906.    * GNU C complains about program fragments such as `0x74ae-0x4000'
  907.      which appear to be two hexadecimal constants separated by the minus
  908.      operator.  Actually, this string is a single "preprocessing token".
  909.      Each such token must correspond to one token in C.  Since this
  910.      does not, GNU C prints an error message.  Although it may appear
  911.      obvious that what is meant is an operator and two values, the ANSI
  912.      C standard specifically requires that this be treated as erroneous.
  913.  
  914.      A "preprocessing token" is a "preprocessing number" if it begins
  915.      with a digit and is followed by letters, underscores, digits,
  916.      periods and `e+', `e-', `E+', or `E-' character sequences.
  917.  
  918.      To make the above program fragment valid, place whitespace in
  919.      front of the minus sign.  This whitespace will end the
  920.      preprocessing number.
  921.  
  922. 
  923. File: gcc.info,  Node: Fixed Headers,  Next: Standard Libraries,  Prev: Incompatibilities,  Up: Trouble
  924.  
  925. Fixed Header Files
  926. ==================
  927.  
  928.    GCC needs to install corrected versions of some system header files.
  929. This is because most target systems have some header files that won't
  930. work with GCC unless they are changed.  Some have bugs, some are
  931. incompatible with ANSI C, and some depend on special features of other
  932. compilers.
  933.  
  934.    Installing GCC automatically creates and installs the fixed header
  935. files, by running a program called `fixincludes' (or for certain
  936. targets an alternative such as `fixinc.svr4').  Normally, you don't
  937. need to pay attention to this.  But there are cases where it doesn't do
  938. the right thing automatically.
  939.  
  940.    * If you update the system's header files, such as by installing a
  941.      new system version, the fixed header files of GCC are not
  942.      automatically updated.  The easiest way to update them is to
  943.      reinstall GCC.  (If you want to be clever, look in the makefile
  944.      and you can find a shortcut.)
  945.  
  946.    * On some systems, in particular SunOS 4, header file directories
  947.      contain machine-specific symbolic links in certain places.  This
  948.      makes it possible to share most of the header files among hosts
  949.      running the same version of SunOS 4 on different machine models.
  950.  
  951.      The programs that fix the header files do not understand this
  952.      special way of using symbolic links; therefore, the directory of
  953.      fixed header files is good only for the machine model used to
  954.      build it.
  955.  
  956.      In SunOS 4, only programs that look inside the kernel will notice
  957.      the difference between machine models.  Therefore, for most
  958.      purposes, you need not be concerned about this.
  959.  
  960.      It is possible to make separate sets of fixed header files for the
  961.      different machine models, and arrange a structure of symbolic
  962.      links so as to use the proper set, but you'll have to do this by
  963.      hand.
  964.  
  965.    * On Lynxos, GCC by default does not fix the header files.  This is
  966.      because bugs in the shell cause the `fixincludes' script to fail.
  967.  
  968.      This means you will encounter problems due to bugs in the system
  969.      header files.  It may be no comfort that they aren't GCC's fault,
  970.      but it does mean that there's nothing for us to do about them.
  971.  
  972. 
  973. File: gcc.info,  Node: Standard Libraries,  Next: Disappointments,  Prev: Fixed Headers,  Up: Trouble
  974.  
  975. Standard Libraries
  976. ==================
  977.  
  978.    GCC by itself attempts to be what the ISO/ANSI C standard calls a
  979. "conforming freestanding implementation".  This means all ANSI C
  980. language features are available, as well as the contents of `float.h',
  981. `limits.h', `stdarg.h', and `stddef.h'.  The rest of the C library is
  982. supplied by the vendor of the operating system.  If that C library
  983. doesn't conform to the C standards, then your programs might get
  984. warnings (especially when using `-Wall') that you don't expect.
  985.  
  986.    For example, the `sprintf' function on SunOS 4.1.3 returns `char *'
  987. while the C standard says that `sprintf' returns an `int'.  The
  988. `fixincludes' program could make the prototype for this function match
  989. the Standard, but that would be wrong, since the function will still
  990. return `char *'.
  991.  
  992.    If you need a Standard compliant library, then you need to find one,
  993. as GCC does not provide one.  The GNU C library (called `glibc') has
  994. been ported to a number of operating systems, and provides ANSI/ISO,
  995. POSIX, BSD and SystemV compatibility.  You could also ask your operating
  996. system vendor if newer libraries are available.
  997.  
  998. 
  999. File: gcc.info,  Node: Disappointments,  Next: C++ Misunderstandings,  Prev: Standard Libraries,  Up: Trouble
  1000.  
  1001. Disappointments and Misunderstandings
  1002. =====================================
  1003.  
  1004.    These problems are perhaps regrettable, but we don't know any
  1005. practical way around them.
  1006.  
  1007.    * Certain local variables aren't recognized by debuggers when you
  1008.      compile with optimization.
  1009.  
  1010.      This occurs because sometimes GCC optimizes the variable out of
  1011.      existence.  There is no way to tell the debugger how to compute the
  1012.      value such a variable "would have had", and it is not clear that
  1013.      would be desirable anyway.  So GCC simply does not mention the
  1014.      eliminated variable when it writes debugging information.
  1015.  
  1016.      You have to expect a certain amount of disagreement between the
  1017.      executable and your source code, when you use optimization.
  1018.  
  1019.    * Users often think it is a bug when GCC reports an error for code
  1020.      like this:
  1021.  
  1022.           int foo (struct mumble *);
  1023.           
  1024.           struct mumble { ... };
  1025.           
  1026.           int foo (struct mumble *x)
  1027.           { ... }
  1028.  
  1029.      This code really is erroneous, because the scope of `struct
  1030.      mumble' in the prototype is limited to the argument list
  1031.      containing it.  It does not refer to the `struct mumble' defined
  1032.      with file scope immediately below--they are two unrelated types
  1033.      with similar names in different scopes.
  1034.  
  1035.      But in the definition of `foo', the file-scope type is used
  1036.      because that is available to be inherited.  Thus, the definition
  1037.      and the prototype do not match, and you get an error.
  1038.  
  1039.      This behavior may seem silly, but it's what the ANSI standard
  1040.      specifies.  It is easy enough for you to make your code work by
  1041.      moving the definition of `struct mumble' above the prototype.
  1042.      It's not worth being incompatible with ANSI C just to avoid an
  1043.      error for the example shown above.
  1044.  
  1045.    * Accesses to bitfields even in volatile objects works by accessing
  1046.      larger objects, such as a byte or a word.  You cannot rely on what
  1047.      size of object is accessed in order to read or write the bitfield;
  1048.      it may even vary for a given bitfield according to the precise
  1049.      usage.
  1050.  
  1051.      If you care about controlling the amount of memory that is
  1052.      accessed, use volatile but do not use bitfields.
  1053.  
  1054.    * GCC comes with shell scripts to fix certain known problems in
  1055.      system header files.  They install corrected copies of various
  1056.      header files in a special directory where only GCC will normally
  1057.      look for them.  The scripts adapt to various systems by searching
  1058.      all the system header files for the problem cases that we know
  1059.      about.
  1060.  
  1061.      If new system header files are installed, nothing automatically
  1062.      arranges to update the corrected header files.  You will have to
  1063.      reinstall GCC to fix the new header files.  More specifically, go
  1064.      to the build directory and delete the files `stmp-fixinc' and
  1065.      `stmp-headers', and the subdirectory `include'; then do `make
  1066.      install' again.
  1067.  
  1068.    * On 68000 and x86 systems, for instance, you can get paradoxical
  1069.      results if you test the precise values of floating point numbers.
  1070.      For example, you can find that a floating point value which is not
  1071.      a NaN is not equal to itself.  This results from the fact that the
  1072.      floating point registers hold a few more bits of precision than
  1073.      fit in a `double' in memory.  Compiled code moves values between
  1074.      memory and floating point registers at its convenience, and moving
  1075.      them into memory truncates them.
  1076.  
  1077.      You can partially avoid this problem by using the `-ffloat-store'
  1078.      option (*note Optimize Options::.).
  1079.  
  1080.    * On the MIPS, variable argument functions using `varargs.h' cannot
  1081.      have a floating point value for the first argument.  The reason
  1082.      for this is that in the absence of a prototype in scope, if the
  1083.      first argument is a floating point, it is passed in a floating
  1084.      point register, rather than an integer register.
  1085.  
  1086.      If the code is rewritten to use the ANSI standard `stdarg.h'
  1087.      method of variable arguments, and the prototype is in scope at the
  1088.      time of the call, everything will work fine.
  1089.  
  1090.    * On the H8/300 and H8/300H, variable argument functions must be
  1091.      implemented using the ANSI standard `stdarg.h' method of variable
  1092.      arguments.  Furthermore, calls to functions using `stdarg.h'
  1093.      variable arguments must have a prototype for the called function
  1094.      in scope at the time of the call.
  1095.  
  1096. 
  1097. File: gcc.info,  Node: C++ Misunderstandings,  Next: Protoize Caveats,  Prev: Disappointments,  Up: Trouble
  1098.  
  1099. Common Misunderstandings with GNU C++
  1100. =====================================
  1101.  
  1102.    C++ is a complex language and an evolving one, and its standard
  1103. definition (the ISO C++ standard) was only recently completed.  As a
  1104. result, your C++ compiler may occasionally surprise you, even when its
  1105. behavior is correct.  This section discusses some areas that frequently
  1106. give rise to questions of this sort.
  1107.  
  1108. * Menu:
  1109.  
  1110. * Static Definitions::  Static member declarations are not definitions
  1111. * Temporaries::         Temporaries may vanish before you expect
  1112. * Copy Assignment::     Copy Assignment operators copy virtual bases twice
  1113.  
  1114. 
  1115. File: gcc.info,  Node: Static Definitions,  Next: Temporaries,  Up: C++ Misunderstandings
  1116.  
  1117. Declare *and* Define Static Members
  1118. -----------------------------------
  1119.  
  1120.    When a class has static data members, it is not enough to *declare*
  1121. the static member; you must also *define* it.  For example:
  1122.  
  1123.      class Foo
  1124.      {
  1125.        ...
  1126.        void method();
  1127.        static int bar;
  1128.      };
  1129.  
  1130.    This declaration only establishes that the class `Foo' has an `int'
  1131. named `Foo::bar', and a member function named `Foo::method'.  But you
  1132. still need to define *both* `method' and `bar' elsewhere.  According to
  1133. the draft ANSI standard, you must supply an initializer in one (and
  1134. only one) source file, such as:
  1135.  
  1136.      int Foo::bar = 0;
  1137.  
  1138.    Other C++ compilers may not correctly implement the standard
  1139. behavior.  As a result, when you switch to `g++' from one of these
  1140. compilers, you may discover that a program that appeared to work
  1141. correctly in fact does not conform to the standard: `g++' reports as
  1142. undefined symbols any static data members that lack definitions.
  1143.  
  1144.